import uView from 'uni_modules/uview-ui'
import store from '@/store';
import App from './App'
import messages from '@/locale/index'
import utils from '@/utils/utils.js'
import storage from "@/utils/storage.js"
import moment from 'moment'
Vue.prototype.$moment = moment;


//引入websocket文件
// import wsRequest from '@/config/websocket.js'
//开启websocket
// let websocket = new wsRequest(`scada/websocket/app/msgBox/${storage.get('principal').username}`, 5000)
//挂载到全局
// Vue.prototype.$socket = websocket
// 全局方法挂载
Vue.use(utils)
Vue.use(uView)

let i18nConfig = {
	locale: uni.getStorageSync('lang') || 'zh-Hans',
	messages,
}

// #ifndef VUE3
import Vue from 'vue'
import VueI18n from 'vue-i18n'
Vue.use(VueI18n)
const i18n = new VueI18n(i18nConfig)
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	i18n,
	store,
	...App
})
// 引入请求封装，将app参数传递到配置中
require('@/config/http.interceptor.js')(app)
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
import { createI18n } from 'vue-i18n'
const i18n = createI18n(i18nConfig)
export function createApp() {
	const app = createSSRApp(App)
	app.use(i18n)
	return {
		app
	}
}
// #endif

